home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / TrapRegionProjectile.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  1.9 KB  |  53 lines

  1. public class TrapRegionProjectile extends Codex {
  2.    private static final int TIMER_ID_INACTIVE = 1;
  3.    private static final int TIMER_ID_MULTIPLE = 2;
  4.    private CodexThing _emitter;
  5.    private String _templateName;
  6.    private int _numProjectiles;
  7.    private float _delayBetween;
  8.    private int _scatter;
  9.    private float _delayInactive;
  10.    private boolean bActive;
  11.    private float[] offset;
  12.    public static String[] _params = new String[]{"Emitter thing", "Template to fire", "Number of projectiles;1", "Delay in between;0.0", "Scatter;0", "Delay Inactive;5.0"};
  13.  
  14.    public void entered(int guid, int causeGUID, int captureID) {
  15.       if (!this.bActive) {
  16.          if (Codex.IsActorGuid(causeGUID)) {
  17.             this._emitter.FireProjectileAtThing(this._templateName, causeGUID, this.offset);
  18.             this.bActive = true;
  19.             ((Codex)this).SetTimer(this._delayInactive, 1);
  20.             if (this._numProjectiles > 1) {
  21.                ((Codex)this).SetTimer(this._delayBetween, 2, (float)causeGUID, 1.0F);
  22.             }
  23.  
  24.          }
  25.       }
  26.    }
  27.  
  28.    public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) {
  29.       if (timerID == 1) {
  30.          this.bActive = false;
  31.       } else {
  32.          this._emitter.FireProjectileAtThing(this._templateName, (int)arg0, this.offset);
  33.          if ((int)arg1 + 1 < this._numProjectiles) {
  34.             ((Codex)this).SetTimer(this._delayBetween, 2, (float)((int)arg0), (float)((int)arg1 + 1));
  35.          }
  36.       }
  37.  
  38.    }
  39.  
  40.    public TrapRegionProjectile(CodexThing emitter, String templateName, int numProjectiles, float delayBetween, int scatter, float delayInactive) {
  41.       this._emitter = new CodexThing(((Codex)emitter).GetGUID());
  42.       this._templateName = templateName;
  43.       this._numProjectiles = numProjectiles;
  44.       this._delayBetween = delayBetween;
  45.       this._scatter = scatter;
  46.       this._delayInactive = delayInactive;
  47.       this.offset = new float[3];
  48.       this.offset[0] = 0.0F;
  49.       this.offset[1] = 0.0F;
  50.       this.offset[2] = 0.0F;
  51.    }
  52. }
  53.